var NodeRSA = require("node-rsa");
const _pubKey = 
`
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDPbZf5KeC9t7GlXCQ7SM/vaP5c
T7QHHy8K/sG3Trb79anh3PAS+Yt2Uz5ilWIp/Ed8KOSm4jnE89OBQTMGeTzPnDP4
H1QBDkIS3bHP4eXbMWhtr93mONeFir3q73SmI389C3ThzDxbCQ7jWfqgGSrx9SxB
hz+S8E5iIvC6A+yOCQIDAQAB
-----END PUBLIC KEY-----
`

function RSAencrypt(data){
  const pubKey = new NodeRSA(_pubKey);
  pubKey.setOptions({encryptionScheme: 'pkcs1'});
  var endata = pubKey.encrypt(data, 'base64');//加密 
  return endata;
}


module.exports =  RSAencrypt;